package 多线程和队列.淺拷貝深拷貝;

/**
 * @author Amos  2022/12/4
 */
public class DeepCopyDemo {
    public static void main(String[] args) {

        Person1 person1 = new
                Person1("zhangsan",18);
        Student1 s1 = new Student1();
        s1.setPerson1(person1);
        s1.setName("lisi");
        s1.setAge(19);
//拷贝
        Student1 s2 = (Student1) s1.clone();
//Student s2 = s1;
        s2.setName("wangwu");
        s2.setAge(20);
        Person1 person2 = s2.getPerson1();
        person2.setName("zhaoliu");
        System.out.println("s1："+s1.toString());
        System.out.println("s2："+s2.toString());
    }
}
